Skip to content

Issue 159: datagrid right click#170

Merged
eviltester merged 6 commits into
masterfrom
159-datagrid-right-click
Jun 9, 2026
Merged

Issue 159: datagrid right click#170
eviltester merged 6 commits into
masterfrom
159-datagrid-right-click

Conversation

@eviltester

@eviltester eviltester commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • add datagrid right-click menu support
  • fix Jest execution in worktrees and Windows-oriented workspace test runs
  • update affected bootstrap expectations and CLI test timing

Verification

  • pnpm run verify:local

Summary by CodeRabbit

  • New Features

    • Added right-click context menu to grid editor with options to add rows and enforce unique column names
    • Added preview and export format selection capabilities to import/export workspace
    • Added automatic column width sizing feature to grid editor
  • Tests

    • Added functional tests for grid context menu interactions
    • Updated grid and export-related unit tests to cover new functionality

Copilot AI review requested due to automatic review settings June 9, 2026 13:05
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

The PR centralizes Jest test configuration into a shared root config and implements a right-click context menu for the data grid editor with auto-fit column width and preview/export format actions. Import/export UI is enhanced to support opening details and triggering workflows from the context menu.

Changes

Jest Configuration Consolidation

Layer / File(s) Summary
Root configuration and app-specific overrides
jest.config.cjs, apps/api/jest.config.cjs, apps/cli/jest.config.cjs, apps/mcp/jest.config.cjs, packages/core/package.json
Root jest.config.cjs centralizes test discovery, coverage, and module mappings. App-level configs spread the root config and override testEnvironment, rootDir, and testMatch for their test locations.
Package.json test script updates
package.json
Test scripts (test, testverbose, testcoverage, test:ui:jest, benchmark:tabulator) are updated to use --config ./jest.config.cjs for consistency.
Test service contract updates
apps/web/src/tests/jest/script-bootstrap.test.js, apps/web/src/tests/jest/script-module-init.test.js
Tests validating bootstrapApp and createDataGridComponent are updated to expect expanded services objects including getPreviewExportFormats, previewAs, and exportAs alongside existing TabulatorCtor and GridExtensionClass.

Data Grid Context Menu with Auto-fit and Preview/Export

Layer / File(s) Summary
Context menu view implementation and event handling
packages/core-ui/js/gui_components/data-grid-editor/data-grid-component-view.js
DataGridComponentView adds context-menu state management, bound event handlers for grid right-click and document interactions, template container for the menu, and methods for rendering/opening/closing. Menu rendering positions the element, builds actions from controller state, synchronizes row selection, and wires checkbox/button interactions. Event listeners are registered in createChildren() and cleaned up in destroy().
Column auto-fit (sizeColumnsToFit) implementation
packages/core-ui/js/gui_components/data-grid-editor/tabulator/gridExtension-tabulator.js, packages/core-ui/js/gui_components/data-grid-editor/data-grid-component-controller.js, packages/core-ui/js/gui_components/data-grid-editor/index.js
GridExtensionTabulator adds sizeColumnsToFit() method that estimates widths from a limited sample of active rows and applies them via setWidth/updateDefinition. Controller and public API delegate to this capability, replacing a no-op placeholder.
Import/export integration for preview and download actions
packages/core-ui/js/gui_components/app/import-export-workspace/import-export-workspace-view.js, packages/core-ui/js/gui_components/app/import-export-workspace/create-import-export-workspace-runtime.js, packages/core-ui/js/gui_components/app/page/app-page-runtime.js
ImportExportWorkspaceView exposes openToolbarDetails() to programmatically open the details UI. ImportExportWorkspaceRuntime adds openDetails(), previewAs(), and downloadAs() methods. AppPageRuntime creates a createContextMenuFormatItems() helper to generate format menu items from tab definitions, and wires grid services to provide getPreviewExportFormats and route previewAs/exportAs through openDetails() before delegating to controller handlers.
Context menu styling and test coverage
apps/web/styles.css, apps/web/src/tests/browser/app/abstractions/components/grid-editor.component.js, apps/web/src/tests/browser/app/functional/grid-editor/context-menu/right-click-context-menu.spec.js, packages/core-ui/src/tests/grid/data-grid-component-view.test.js, packages/core-ui/src/tests/grid/data-grid-component-controller.test.js, packages/core-ui/src/tests/grid/tabulator-duplicate-column-copy.test.js
CSS defines layout, positioning, and visual appearance for .data-grid-context-menu and sub-elements. Playwright harness adds context menu locators and helper methods. Playwright functional test validates menu actions (add row, toggle unique column names). Jest unit tests add mocks, validate context menu visibility/interactions, and verify auto-fit samples only active rows.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • eviltester/grid-table-editor#119: Relates to unique-column-name and destructive-action flow changes in the data-grid editor, including modal-based input/confirmation UI patterns that the context menu integrates with.
  • eviltester/grid-table-editor#66: Prior Jest test migration work modifying the same apps/*/jest.config.cjs entry points and test runner configuration that this PR completes.

Poem

A menu appears on right-click's call,
With auto-fit columns standing tall.
Preview and export, now at hand,
Grid editor flows, precisely planned! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Issue 159: datagrid right click' directly relates to the main changeset, which implements right-click context menu functionality for the datagrid component.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 159-datagrid-right-click

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/api/jest.config.cjs

Oops! Something went wrong! :(

ESLint: 10.2.1

A config object is using the "root" key, which is not supported in flat config system.

Flat configs always act as if they are the root config file, so this key can be safely removed.

apps/cli/jest.config.cjs

Oops! Something went wrong! :(

ESLint: 10.2.1

A config object is using the "root" key, which is not supported in flat config system.

Flat configs always act as if they are the root config file, so this key can be safely removed.

apps/mcp/jest.config.cjs

Oops! Something went wrong! :(

ESLint: 10.2.1

A config object is using the "root" key, which is not supported in flat config system.

Flat configs always act as if they are the root config file, so this key can be safely removed.

  • 15 others

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review


P2 Badge Await the grid import before sizing columns

When the sample/instructions actions run against the Tabulator adapter, importer.setGridFromGenericDataTable(dataTable) returns the promise from GridExtensionTabulator.setGridFromGenericDataTable, which enqueues async setColumns/setData. This newly added call runs immediately afterward, so it sizes the previous grid before the imported rows and columns exist; once the import completes, the requested all-column fit is never applied.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/core-ui/js/gui_components/app/page/app-page-runtime.js

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a right-click context menu to the data grid (including preview/export hooks and an “auto fit columns” action), while also moving Jest configuration into dedicated jest.config.cjs files to improve test execution across worktrees and Windows, and updating affected unit/browser tests accordingly.

Changes:

  • Introduces a data-grid context menu UI + handlers, plus runtime wiring for preview/export actions via injected services.
  • Adds a Tabulator sizeColumnsToFit() implementation and exposes it through the component/controller APIs.
  • Centralizes Jest configuration into jest.config.cjs and updates workspace scripts/tests to reference it; adds/updates Playwright + Jest expectations.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/core/package.json Updates core workspace Jest invocation to use the shared config and path patterns.
packages/core-ui/src/tests/grid/data-grid-component-view.test.js Adds view-level test coverage for context menu behavior and routed actions.
packages/core-ui/src/tests/grid/data-grid-component-controller.test.js Extends controller tests to cover the new sizeColumnsToFit() call-through.
packages/core-ui/js/gui_components/data-grid-editor/tabulator/gridExtension-tabulator.js Adds Tabulator implementation for sizeColumnsToFit() and refactors column width estimation.
packages/core-ui/js/gui_components/data-grid-editor/index.js Wires public component API sizeColumnsToFit() through to the controller.
packages/core-ui/js/gui_components/data-grid-editor/data-grid-component-view.js Implements context menu DOM, rendering, event handling, and preview/export routing.
packages/core-ui/js/gui_components/data-grid-editor/data-grid-component-controller.js Adds controller method sizeColumnsToFit() that delegates to grid extras.
packages/core-ui/js/gui_components/app/page/app-page-runtime.js Injects context-menu format items and routes preview/export actions through the import/export workspace.
packages/core-ui/js/gui_components/app/import-export-workspace/import-export-workspace-view.js Adds view helpers to open the toolbar <details> section.
packages/core-ui/js/gui_components/app/import-export-workspace/create-import-export-workspace-runtime.js Exposes openDetails(), previewAs(), and downloadAs() controller-style helpers.
package.json Removes inline Jest config and updates scripts to use jest.config.cjs.
jest.config.cjs Adds centralized Jest configuration previously embedded in package.json.
apps/web/styles.css Adds styling for the new data-grid context menu.
apps/web/src/tests/jest/script-module-init.test.js Updates bootstrap expectations to allow injected context menu services.
apps/web/src/tests/jest/script-bootstrap.test.js Updates bootstrap expectations to allow injected context menu services.
apps/web/src/tests/browser/app/functional/grid-editor/context-menu/right-click-context-menu.spec.js Adds Playwright functional coverage for right-click menu actions (add row/preview/export).
apps/web/src/tests/browser/app/abstractions/components/grid-editor.component.js Extends browser test abstraction with context-menu helpers.
apps/mcp/package.json Updates MCP workspace test script to use a local Jest config.
apps/mcp/jest.config.cjs Adds workspace Jest config extending the base config.
apps/cli/src/tests/integration.cli-params.test.js Adjusts integration test timeout to reduce flakiness.
apps/cli/jest.config.cjs Switches CLI workspace Jest config to extend the base config and adjust rootDir/testMatch.
apps/api/jest.config.cjs Switches API workspace Jest config to extend the base config and adjust rootDir/testMatch.

Comment thread packages/core-ui/js/gui_components/data-grid-editor/data-grid-component-view.js Outdated
Comment thread packages/core-ui/js/gui_components/data-grid-editor/data-grid-component-view.js Outdated
Comment on lines +342 to +345
openContextMenu(x, y) {
this.contextMenuState = { open: true, x, y };
this.renderContextMenu();
}
@greptile-apps

greptile-apps Bot commented Jun 9, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds a right-click context menu to the data-grid editor, wiring row-management, filter, sort, and column-fit actions through the existing controller layer. It also centralises Jest configuration into a root jest.config.cjs to fix test execution in git worktrees and on Windows, and scaffolds previewAs/exportAs service callbacks for future context-menu export integration.

  • Context menu (data-grid-component-view.js): Renders on contextmenu, syncs row selection to the right-clicked target, routes actions via delegated click/change listeners, and dismisses on outside pointerdown or Escape. Event listeners are properly torn down in destroy().
  • sizeColumnsToFit (gridExtension-tabulator.js): New method estimates per-column width from a 500-row sample and applies widths inside a blockRedraw/restoreRedraw batch; the existing _estimateFirstColumnWidth is refactored to reuse the new helper.
  • Jest config consolidation (jest.config.cjs + per-app configs): Moves shared moduleNameMapper, testMatch, and transform settings to a single root config that all app and package configs extend via spread.

Confidence Score: 5/5

Safe to merge; no correctness regressions on the changed paths.

The context-menu feature is self-contained: event listeners are attached and cleaned up symmetrically, actions delegate to the existing controller API without bypassing any guards, and the new browser spec exercises the two most important flows. The Jest config consolidation is mechanical and well-tested by the existing suite. The only issues found are minor edge-case observations on rarely-hit code paths.

No files require special attention.

Important Files Changed

Filename Overview
packages/core-ui/js/gui_components/data-grid-editor/data-grid-component-view.js Core context-menu feature: adds right-click menu with row/filter/sort actions, selection sync, and keyboard+pointer dismiss. Event listeners are properly cleaned up on destroy.
packages/core-ui/js/gui_components/data-grid-editor/tabulator/gridExtension-tabulator.js Adds sizeColumnsToFit() using a batched _runWithoutRedraw loop; refactors _estimateFirstColumnWidth into a shared _estimateColumnWidth helper. The updateDefinition fallback path is called without await inside the sync callback.
packages/core-ui/js/gui_components/app/import-export-workspace/create-import-export-workspace-runtime.js Exposes openDetails, previewAs, and downloadAs on the workspace controller API to support future context-menu export wiring.
packages/core-ui/js/gui_components/app/page/app-page-runtime.js Adds createContextMenuFormatItems helper and wires getPreviewExportFormats/previewAs/exportAs service callbacks into the data grid component.
apps/web/src/tests/browser/app/functional/grid-editor/context-menu/right-click-context-menu.spec.js New Playwright browser spec covering add-row and unique-column-names sync via the right-click context menu; clean and focused.
jest.config.cjs New root-level Jest base config centralising testMatch, moduleNameMapper, and coverage settings.
apps/web/src/tests/browser/app/abstractions/components/grid-editor.component.js Adds contextMenu locator and openContextMenuOnCell / contextMenuAddRow / contextMenuSetUniqueColumnNames helpers to the Playwright page object abstraction.

Reviews (4): Last reviewed commit: "Merge remote-tracking branch 'origin/mas..." | Re-trigger Greptile

…click

# Conflicts:
#	apps/api/jest.config.cjs
#	apps/cli/jest.config.cjs
#	apps/cli/src/tests/integration.cli-params.test.js
#	apps/mcp/jest.config.cjs
#	package.json
@eviltester eviltester merged commit 8fe3e9b into master Jun 9, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants